﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataModel.Models;

namespace DataModel.Managers
{
    public class SubjectManager
    {
        UniversityPortalEntities entityModel;

        public SubjectManager()
        {
            entityModel = new UniversityPortalEntities();
        }

        public IEnumerable<SubjectModel> GetAllSubjects()
        {
            var subjectModels = new List<SubjectModel>();
            if (entityModel.Subjects == null) return null;
            subjectModels = entityModel.Subjects.Select(s => new SubjectModel()
            {
                SubjectID = s.ID,
                FullName = s.fullName,
                ShortName = s.shortName,
                Desription = s.desription
            }).ToList();
            return subjectModels;
        }
    }
}
